package org.brownflat.watergate.domain;

import java.util.List;

/**
 * <p>&copy Rupert Jones 2012</p>
 *
 * @author rup
 */
public class ReviewBuilder extends AbstractBuilder<Review> {
    public ReviewBuilder() {
        super(new Review());
    }

    public ReviewBuilder withComments(List<Comment> comments) {
        getEntity().setComments(comments);
        return this;
    }

    public ReviewBuilder withCommits(List<Commit> commits) {
        getEntity().setCommits(commits);
        return this;
    }

    public ReviewBuilder withCommit(Commit commit) {
        getEntity().addCommit(commit);
        return this;
    }

    public ReviewBuilder withContributors(List<ReviewContribution> contributions) {
        getEntity().setReviewContributions(contributions);
        return this;
    }

    public ReviewBuilder withReviewState(ReviewState reviewState) {
        getEntity().setReviewState(reviewState);
        return this;
    }

    public ReviewBuilder withTitle(String title) {
        getEntity().setTitle(title);
        return this;
    }

    public ReviewBuilder withContribution(ReviewContribution contribution) {
        contribution.setReview(build());
        getEntity().addReviewContribution(contribution);
        return this;
    }

    public ReviewBuilder withCreator(User user) {
        getEntity().setCreator(user);
        return this;
    }
}
